﻿
@{
    Layout = null;
    bool DeviceState = true;
    bool FanState = true;
    bool CleaerState = true;
    DateTime temptime = DateTime.Parse(ViewBag.DeviceDataMap["lastConnTime"].ToString());
    if (temptime>DateTime.Now.AddMinutes(-5))
    {
        DeviceState = true;
    }
    else
    {
        DeviceState = false;
    }

    if( 0.1<double.Parse(ViewBag.DeviceDataMap["amp1"].ToString()) )
    {
        FanState = true;
    }
    else
    {
        FanState = false;
    }

    if (0.1 < double.Parse(ViewBag.DeviceDataMap["amp2"].ToString()))
    {
        CleaerState = true;
    }
    else
    {
        CleaerState = false;
    }

    //电晕电压 电流
    //Random ra = new Random();
    //double DYDY = Math.Round(ra.NextDouble() * (0.5) + 11, 1);
    //double DYDL = Math.Round(ra.NextDouble() * (1) + 5, 1);

}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="~/Content/ShopDetail/shopDetail.css" media="all" />
    <script src="~/Scripts/shopDetail/shopDetail.js" type="text/javascript"></script>
    <script src="~/Scripts/echarts.min.js"></script>
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    <title>德器物联</title>
</head>
<body>
    <div class="wap">
        <div>
            <span class="bh">@ViewBag.DeviceDataMap["Name"]<a class="float_r bh bh2" href="/DataView/Main">返回</a></span>
        </div>
        @if (ViewBag.DeviceDataMap["ChannelNum"].ToString() == "2")
        {
            <div>通道1：</div>
            <div class="ywh">
                <div>
                    <div id="realTime1">@ViewBag.DeviceDataMap["Y1"]</div>
                    <div class="modal_animation"></div>
                    <div class="clear"></div>
                </div>

                <span style="position:absolute;bottom:1%;left:62%;font-size:1.2rem;">mg/m³</span>
                <div class="p_matters">
                    <p>颗粒物浓度：<span id="p_matter1">@ViewBag.DeviceDataMap["K1"]</span></p>
                    <p>NMHC：<span id="methane1">@ViewBag.DeviceDataMap["V1"]</span></p>
                </div>
                <div class="square">
                    <div class="item2"></div>
                    <div class="item1"></div>
                </div>
            </div>

            <div>通道2：</div>
            <div class="ywh2">
                <div>
                    <div id="realTime2">@ViewBag.DeviceDataMap["Y2"]</div>
                    <div class="modal_animation"></div>
                    <div class="clear"></div>
                </div>

                <span style="position:absolute;bottom:1%;left:62%;font-size:1.2rem;">mg/m³</span>
                <div class="p_matters">
                    <p>颗粒物浓度：<span id="p_matter2">@ViewBag.DeviceDataMap["K2"]</span></p>
                    <p>NMHC：<span id="methane2">@ViewBag.DeviceDataMap["V2"]</span></p>
                </div>
                <div class="square">
                    <div class="item2"></div>
                    <div class="item1"></div>
                </div>
            </div>
        }
        else
        {
            <div class="ywh">
                <div>
                    <div id="realTime1">@ViewBag.DeviceDataMap["Y1"]</div>
                    <div class="modal_animation"></div>
                    <div class="clear"></div>
                </div>

                <span style="position:absolute;bottom:1%;left:62%;font-size:1.2rem;">mg/m³</span>
                <div class="p_matters">
                    <p>颗粒物浓度：<span id="p_matter1">@ViewBag.DeviceDataMap["K1"]</span></p>
                    <p>NMHC：<span id="methane1">@ViewBag.DeviceDataMap["V1"]</span></p>
                </div>
                <div class="square">
                    <div class="item2"></div>
                    <div class="item1"></div>
                </div>
            </div>
        }


        <div class="title">实时油烟浓度</div>
        <a class="lishi" href="/DataView/History?MN=@ViewBag.DeviceDataMap["MN"]">查看历史排放浓度&gt;&gt;</a>

        @if (ViewBag.DeviceDataMap["ChannelNum"].ToString() == "2")
        {
            <div class="data_chart" style="position:relative;">
                <div id="main" style="width: 100%;height:20rem"></div>
                <div class="h">(h)</div>
                <div class="mgm">(mg/m³)</div>
            </div>

            <div class="data_chart" style="position:relative;">
                <div id="main2" style="width: 100%;height:20rem"></div>
                <div class="h">(h)</div>
                <div class="mgm">(mg/m³)</div>
            </div>
        }
        else
        {
            <div class="data_chart" style="position:relative;">
                <div id="main" style="width: 100%;height:20rem"></div>
                <div class="h">(h)</div>
                <div class="mgm">(mg/m³)</div>
            </div>
        }



    <div class="cartent">
        <div class="li">
            <div class="quan float_l">1</div>
            <div class="text float_l">设备状态</div>
            <div class="code float_r">
                @if (DeviceState)
                {
                    <span>在线</span>
                }
                else
                {
                    <span>离线</span>
                }

            </div>
            <div class="clear"></div>
        </div>
        <div class="li">
            <div class="quan float_l">2</div>
            <div class="text float_l">风机状态</div>
            @if (DeviceState)
            {
                <div class="code float_r" id="fsl_state">电流 @ViewBag.DeviceDataMap["amp1"] A</div>
            }
            else
            {
                <div class="code float_r" id="fsl_state">——</div>
            }

            <div class="clear"></div>
        </div>
        <div class="li">
            <div class="quan float_l">3</div>
            <div class="text float_l">净化器状态</div>
            @if (DeviceState)
            {
                <div class="code float_r">
                    电流 @ViewBag.DeviceDataMap["amp2"] A
                </div>
            }
            else
            {
                <div class="code float_r" id="fsl_state">——</div>
            }

            <div class="clear"></div>
        </div>
        <div class="li">
            <div class="quan float_l">4</div>
            <div class="text float_l">电晕电压</div>
            @if (DeviceState)
            {
        <div class="code float_r">
            电压  @ViewBag.DeviceDataMap["DYDY"] V
        </div>
            }
            else
            {
                <div class="code float_r" id="fsl_state">——</div>
            }

            <div class="clear"></div>
        </div>
        <div class="li">
            <div class="quan float_l">5</div>
            <div class="text float_l">电晕电流</div>
            @if (DeviceState)
            {
        <div class="code float_r">
            电流  @ViewBag.DeviceDataMap["DYDL"] mA
        </div>
            }
            else
            {
                <div class="code float_r" id="fsl_state">——</div>
            }

            <div class="clear"></div>
        </div>

        <div class="li">
            <div class="quan float_l">6</div>
            <div class="text float_l">所在城市</div>
            <div class="code float_r">重庆市</div>
            <div class="clear"></div>
        </div>
        <!-- 是否是个人还是管理员 -->
        <div class="li">
            <a href="javascript:;" style="color:#fff;">
                <div class="quan float_l">7</div>
                <div class="text float_l">清洗</div>
                <div class="code float_r">良好 &gt;&gt;</div>
                <div class="clear"></div>
            </a>
        </div>
        <!-- 当设备超标则显示解除超标报警 -->
        <div class="li">
            <a href="/DataView/Record?MN=@ViewBag.DeviceDataMap["MN"]" style="">
                <div class="quan float_l">8</div>
                <div class="text float_l">超标历史</div>
                <div class="code float_r you"></div>
                <div class="clear"></div>
            </a>
        </div>
    </div>

        <div class="tishik">
            <div class="t-text">
                警告
                <div class="t-content">确定强制开启么?</div>
            </div>
            <div>
                <div class="queren float_l" onclick="settime()">确认</div>
                <div class="quxiao float_r">取消</div>
                <div class="clear"></div>
            </div>
        </div>
        <div style="font-size:12px;margin-top:10px;margin-bottom:10px;width:100%;text-align:center">
            ©2020 德器(重庆)科技有限公司 服务热线 400-9019-505
            @*重庆环元环境科学研究院*@
        </div>
    </div>

    <script type="text/javascript">
        var MN = "@ViewBag.DeviceDataMap["MN"]";
        var ChannelNum = "@ViewBag.DeviceDataMap["ChannelNum"].ToString()";
    </script>

</body>
</html>
